package com.nuoniu.sibanyun.userThread;

/**
 * @ClassName UserThreadLocal
 * @Description TODO
 * @Authpr baiqiang
 * @Date 2020/5/29 11:20
 **/

public class UserThreadLocal {
    /**
     * 关于参数的说明
     * 	如果需要传递多值则使用Map集合封装
     */
    private static ThreadLocal<UserInfo> userThread = new ThreadLocal<UserInfo>();

    public static void set(UserInfo userInfo){
        userThread.set(userInfo);
    }

    public static UserInfo get(){
        return userThread.get();
    }

    //防止内存泄漏
    public static void remove(){
        userThread.remove();
    }
}
